<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: easyui-header('参数列表')" />
</head>
<body class="white-bg">
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-head">
				<div class="easyui-panel">
					<form id="config-form">
						<div class="select-list">
							<ul>
								<li>
									<label>参数名称：</label>
									<input type="text" name="configName" class="easyui-textbox" data-options="prompt:'请输入参数名称'"/>
								</li>
								<li>
									<label>参数键名：</label>
									<input type="text" name="configKey" class="easyui-textbox" data-options="prompt:'请输入参数键名'"/>
								</li>
								<li>
									<label>系统内置：</label>
									<select name="configType" class="easyui-combobox" th:with="type=${@dict.getType('sys_yes_no')}">
										<option value=" ">所有</option>
										<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
									</select>
								</li>
								<li>
									<label>创建时间： </label>
									<input type="text" id="startTime" class="easyui-datebox" style="width: 110px;" data-options="prompt:'开始时间'" name="params[beginTime]"/>
									<span>-</span>
									<input type="text" id="endTime" class="easyui-datebox" style="width: 110px;" data-options="prompt:'结束时间'" name="params[endTime]"/>
								</li>
								<li>
									<a class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="$.easyUIDataGrid.search()" >查询</a>
									<a class="easyui-linkbutton" data-options="iconCls:'icon-clear'" onclick="$.easyUIDataGrid.reset()" >重置</a>
								</li>
							</ul>
						</div>
					</form>
				</div>
			</div>
			<div class="col-sm-12 search-body">
			     <div id="toolbar" role="group">
		            <a class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="$.easyUIOperate.add('500','380')" shiro:hasPermission="system:config:add">新增</a>
		            <a class="easyui-linkbutton" data-options="iconCls:'icon-edit'" onclick="$.easyUIOperate.edit('500','380')" shiro:hasPermission="system:config:edit">修改</a>
		            <a class="easyui-linkbutton" data-options="iconCls:'icon-delete'" onclick="$.easyUIOperate.removeAll()" shiro:hasPermission="system:config:remove">删除</a>
		            <a class="easyui-linkbutton" data-options="iconCls:'icon-export'" onclick="$.easyUIOperate.exportExcel()" shiro:hasPermission="system:config:export">导出</a>
		            <a class="easyui-linkbutton" data-options="iconCls:'icon-extjs-cancel'" onclick="clearCache()" shiro:hasPermission="system:config:remove">清理缓存</a>
		        </div>
			    <table id="dg" class="easyui-datagrid"></table>
			</div>
	    </div>
	</div>
	<th:block th:include="include :: easyui-footer" />
 	<script th:inline="javascript">
 		var editFlag = [[${@permission.hasPermi('system:config:edit')}]];
     	var removeFlag = [[${@permission.hasPermi('system:config:remove')}]];
     	var datas = [[${@dict.getType('sys_yes_no')}]];
    </script>
	<script th:inline="none">
        var prefix = ctx + "system/config";
        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                idField: 'configId',
                modalName: "参数",
                sortName: "createTime",
		        sortOrder: "desc",
                columns: [[
                	{
		        		field:'ck',
						checkbox:true,
						width:30
					},
	                {
	                    field: 'configId',
	                    title: '参数主键',
	                    hidden:true,
						width: 20
	                },
	                {
	                    field: 'configName',
	                    title: '参数名称',
	                    align: 'center',
		          		width: 110
	                },
	                {
	                    field: 'configKey',
	                    title: '参数键名',
	                    align: 'center',
		          		width: 100
	                },
	                {
	                    field: 'configValue',
	                    title: '参数键值',
	                    align: 'center',
		          		width: 60
	                },
	                {
	                    field: 'configType',
	                    title: '系统内置',
	                    align: 'center',
		          		width: 50,
	                    formatter: function(value, row, index) {
	                    	return $.table.selectDictLabel(datas, value);
	                    }
	                },
	                {
	                    field: 'remark',
	                    title: '备注',
	                    align: 'center',
	                    width: 200
	                },
	                {
	                    field: 'createTime',
	                    title: '创建时间',
	                    align: 'center',
	                    width: 80
	                },
	                {
	                	field:'action',
	                    title: '操作',
	                    align: 'center',
	                    width: 80,
	                    formatter: function(value, row, index) {
	                        var actions = [];
	                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.easyUIOperate.edit(\'500\',\'380\',\'' + row.configId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
	                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.easyUIOperate.remove(\'' + row.configId + '\')"><i class="fa fa-remove"></i>删除</a>');
	                        return actions.join('');
	                    }
	                }
	        	]]
            };
            $.easyUIDataGrid.init(options);
        });
        
        /** 清理参数缓存 */
        function clearCache() {
            $.easyUIOperate.get(prefix + "/clearCache");
        }
    </script>
</body>
</html>